package com.nartosoft.tubuloader;

import java.applet.Applet;
import java.applet.AudioClip;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

/**
 * @author mf
 * 
 * Plays sounds on certain events
 */

public class SoundPlayer extends EventListenerAdapter {
	final AudioClip sound;

	public SoundPlayer(String soundFile) throws MalformedURLException,
			IOException {
		URL url = new URL("file:" + new File(soundFile).getCanonicalFile());
		sound = Applet.newAudioClip(url);
	}

	public void onAllFilesDone() {
		sound.play();
	}
}
